package com.gmcas.utils;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.Factory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by zhangshuai on 2017/9/15.
 */
public class ShiroUtils {

    @Autowired
    private static Factory<SecurityManager> shiroFilter;

    public static Subject getSubjects(){
        SecurityManager securityManager = shiroFilter.getInstance();
        SecurityUtils.setSecurityManager(securityManager);
        return SecurityUtils.getSubject();
    }
}
